#include "firstwindow.h"
#include "ui_firstwindow.h"
#include "mainwindow.h"

firstWindow::firstWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::firstWindow)
{
    ui->setupUi(this);
    ui->label->setStyleSheet("color: red;");
    ui->label_2->setStyleSheet("color: red;");

    this->setStyleSheet(R"(
    QMainWindow {
            background-image: url(:/img/Picture/background.jpg);
            background-size: 100% 100%;
            background-position: center;
            background-repeat: no-repeat;
        }
    )");
}

firstWindow::~firstWindow()
{
    delete ui;
}

void firstWindow::on_pushButton_clicked()
{
    MainWindow *w = new MainWindow; // 使用指针和 new 关键字来保持窗口在堆上存活
    // w->setWindowFlags(w->windowFlags() & ~Qt::WindowMaximizeButtonHint);
    // w->setFixedSize(800, 600);
    w->show();
    // w->setStyleSheet(R"(
    // QMainWindow {
    //         background-image: url(:/img/Picture/background.jpg);
    //         background-size: 100% 100%;
    //         background-position: center;
    //         background-repeat: no-repeat;
    //     }
    // )");

    this->close(); // 关闭主窗口
}

